package lambdasinaction.chap4.ex;

import java.util.List;
import java.util.stream.Collectors;

import static lambdasinaction.chap4.Dish.menu;

/**
 * Created by gx on 2017/4/13.
 */
public class Test {

    public static void main(String[] args) {
        List<String> names = menu.stream().filter(d -> {
            System.out.println("filtering      " + d.getName());
            return d.getCalories() > 300;
        }).map(d -> {
            System.out.println("~~~~~~~~~~~~~");
            System.out.println("mapping       "+d.getName());
            return d.getName();}
        ).limit(3).collect(Collectors.toList());
        System.out.println(names);
    }
}

